// pages/my/collect/index.js
import {
  BASE_URL
} from '../../../constant/index'
import {
  getDynamycCollectAll
} from '../../../https/dynamic'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    BASE_URL,
    limit: 20,
    page: 1,
    total: 100,
    list: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.getCollectList()
  },
  async getCollectList() {
    const {
      limit,
      page
    } = this.data
    const getRes = await getDynamycCollectAll({
      limit,
      page
    })
    console.log(getRes)
    if (getRes.code == 200) {
      const {
        limit,
        list,
        page,
        total
      } = getRes.data
      console.log(list)
      this.setData({
        limit,
        list,
        page: page + 1,
        total
      })
    }
  },
  // 跳转动态详情
  gotoDetail(e) {
    console.log(e)
    const docid = e.currentTarget.dataset.docid
    wx.navigateTo({
      url: '../../home/detail/index?docid=' + docid,
    })
  }
})